package com.arpa.wms.service;

import com.arpa.core.web.Result;
import com.arpa.wms.domain.dto.PutawayDTO;
import com.arpa.wms.domain.dto.WmsTaskDTO;
import com.arpa.wms.domain.entity.Inbound;
import com.arpa.wms.domain.entity.Putaway;
import com.arpa.wms.domain.entity.PutawayRegister;
import com.arpa.wms.domain.vo.PutawayVO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 上架 服务类
 * </p>
 *
 * @author LEO
 * @since 2020-08-04
 */
public interface IPutawayService extends IService<Putaway> {

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(Putaway entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(Putaway entity);

    /**
     * 查询列表
     * @param putawayDTO
     * @return
     */
    List<PutawayVO> queryList(PutawayDTO putawayDTO);

    /**
     * 查询合计,包含总数
     * @param putawayDTO
     * @return
     */
    PutawayVO queryListSum(PutawayDTO putawayDTO);

    /**
     * 查询合计,包含总数
     * @param putawayDTO
     * @return
     */
    PutawayVO queryListTotal(PutawayDTO putawayDTO);

    /**
     * 上架保存
     * @param entity
     * @return
     */
    Result localSave(Putaway entity);

    /**
     * 上架确认
     * @param entity
     * @return
     */
    Inbound check(Putaway entity);

    /**
     * pda上架确认
     * @param entity
     * @return
     */
    Inbound pdaCheck(Putaway entity);

    PutawayVO getVOByCode(@Param("code") String code);

    /**
     * 更新收货单下发状态
     * @param code
     */
    void updateIssueStatus(String code, String groupCode);

    /**
     *
     * @param inbound
     */
    void orderConfirm(Inbound inbound);

    Result getPutawayInfo(WmsTaskDTO wmsTaskDTO);

    /**
     * 更新上架单已上架数量
     * @author xuyang
     * @date 2020/10/30 16:21
     * @param code:
     * @param registerStatus:
     * @return 更新条数
     **/
    int updateRegisterQuantity(String code, String registerStatus);

    Result putawayDetail(WmsTaskDTO wmsTaskDTO);

    /**
     * 根据上架确认单信息，更新收货确认单、收货明细、收货单的上架信息
     * @param register
     */
    void refreshReceivePutawayQuantity(PutawayRegister register);

    /**
     * 根据上架确认单信息，更新收货确认单、收货明细、收货单的上架和入库信息
     * @param register
     */
    void refreshReceivePutawayAndInboundQuantity(PutawayRegister register);

    /**
     * 根据上架确认单信息，更新调拨单的入库数量
     * @param register
     */
    void refreshAllocationInboundQuantity(PutawayRegister register);
}
